<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 18-8-15
 * Time: 下午5:21
 */

/*$trans = \Yii::$app->db->beginTransaction();
try{
    $trans->commit();
}catch (Exception $e){
    $trans->rollBack();
    throw new ApiException(201808151719, $e->getMessage());
}*/

 /*GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        ['class' => 'kartik\grid\SerialColumn'],
        ['class' => 'kartik\grid\ActionColumn'],
        [
            'label'=>'更多操作',
            'format'=>'raw',
            'mergeHeader' => true,
            'value' => function($model){
                return Html::a(\kartik\icons\Icon::show('universal-access'), ['allot-role', 'menu_id' => $model->id], ['title' => '分配角色']);
            },
        ],
        'id',
        'p_id',
        'yii2_app_id',
        [
            'attribute' => 'icon',
            'format'=>'raw',
            'value' => function($model) {
                return \kartik\icons\Icon::show("{$model->icon}")."({$model->icon})";
            },
        ],
        'title',
        'uri',
        'sort',
        'created_at',
        'created_by',
        'desc:ntext',
    ],
]);*/

/*$key = "AvatarImage-".$this->id;
\Yii::$app->cache->delete($key);
$str = \Yii::$app->cache->get($key);
if (!$str){
    // 'class' => 'without-img marketplace-view-author-row-avatar',
    $options['class'] = $options['class']." marketplace-view-author-row-avatar";
    $hex = bin2hex($this->random_string);
    $hex = substr($hex, 0, 6);
    $hex = strtoupper($hex);
    $color = "#{$hex}";
    $str = TextAvatarWidget::widget([
        'string' => $this->username,
        'size' => "{$l}x{$w}",
        'color' => $color,
//                    'tag' => 'img',
        'options' => $options,
    ]);
    \Yii::$app->cache->set($key, $str, 3600*2);
}*/